package net.wxxr.http.auth;

import net.wxxr.http.request.HttpDeleteRequest;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.exception.OAuthCommunicationException;
import oauth.signpost.exception.OAuthExpectationFailedException;
import oauth.signpost.exception.OAuthMessageSignerException;
import oauth.signpost.http.HttpParameters;

import org.apache.http.client.methods.HttpRequestBase;


/**
 * delete认证方式
 * @author yuanwenfei
 *
 */
public class DeleteAuthSign extends BaseAuthSign {

	HttpDeleteRequest request;
	
	public DeleteAuthSign(OAuthConsumer consumer, HttpDeleteRequest request) {
		super(consumer);
		this.request = request;
	}

	@Override
	public void sign(HttpRequestBase requestBase) throws OAuthMessageSignerException, OAuthExpectationFailedException, OAuthCommunicationException {
		if(request != null) {
			HttpParameters bodyParams = request.getBodyParams();
			if(bodyParams != null) {
				consumer.setAdditionalParameters(bodyParams);
			}
		}
		super.sign(requestBase);
	}
	
}
